// pages/market/shoppingCar/payment/payment.js
const app = getApp()
const request = require('../../../../utils/request');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    checked: false,
    checked1: false,
    checked_all: false,
    icon: {
      normal: '/img/click_out.png',
      active: '/img/click_in.png',
      normal_all: '/img/click_out.png',
      active_all: '/img/click_blue_in.png'
    },
    order: {},
    goods: []
  },
  wxPay() {
    var that = this;
    this.setData({
      checked: true,
      checked1: false
    });
  },
  aliPay() {
    var that = this;
    this.setData({
      checked1: true,
      check: false
    });
  },

  getOrderDetail: function (oid) {
    wx.showLoading()
    const data = {
      token: wx.getStorageSync("token"),
      oid: oid,
    }
    request.get('qr_order', data)
      .then(res => {
        wx.hideLoading()
        this.setData({
          goods: res.goods,
          order: res.order
        })
      })
      .catch(error => {
        wx.showToast({
          icon: 'none',
          title: error.msg && error.msg
        })
      })
      .finally(_ => {
        
      })

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getOrderDetail(options.oid)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})